package com.mkyong.client;

import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;



public class ReadBlobPicture {

	static String url = "jdbc:mysql://localhost:3306/jeux";
    static String username = "root";
    static String password = "root";

    public static void main(String[] args) 
        throws Exception 
    {
        Class.forName("com.mysql.jdbc.Driver");
        Connection conn = (Connection) DriverManager.getConnection(url, username, password);
        String sql = "SELECT image FROM alphabet where id=1";
        Statement stmt = (Statement) conn.prepareStatement(sql);
        ResultSet resultSet = stmt.executeQuery(sql);
        Object obj = resultSet;

        while (resultSet.next()) 
        {
            
            byte[] buffer = new byte[100];
            InputStream is2 = resultSet.getBinaryStream(1);
            System.out.println(is2.available());

            
        }

        conn.close();
    }

}
